package com.cliff.joinme;

import java.util.ArrayList;

import org.cybergarage.upnp.Device;
import org.cybergarage.upnp.DeviceList;
import org.cybergarage.upnp.ssdp.SSDPPacket;

import android.os.Bundle;
import android.widget.Toast;

import com.actionbarsherlock.app.SherlockActivity;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;
import com.actionbarsherlock.view.SubMenu;
import com.androidquery.AQuery;
import com.cliff.joinme.toolkit.ControlPointManager;
import com.cliff.joinme.toolkit.data.MediaItem;

public class BrowseBaseActivity extends SelectRendererActivity {

	protected ArrayList<MediaItem> itemList = null;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		updateRendererDisplay();
		getSupportActionBar().setDisplayHomeAsUpEnabled(true);

		return super.onCreateOptionsMenu(menu);
	}

	protected ArrayList<String> getFilePathNameList() {
		if (null == itemList)
			return null;
		
		ArrayList<String> ret = new ArrayList<String>();
		for (int i = 0; i < itemList.size(); i++)
			ret.add(itemList.get(i).filePathName);
			
		return ret;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		if (android.R.id.home == item.getItemId()) {
			finish();
			return true;
		}
		
		super.onOptionsItemSelected(item);
		if (selectRendererSucceeded)		
			updateRendererDisplay();
		
		return true;
	}

}
